package com.longteng.lession.http;

import static spark.Spark.*;

/**
 * Created by celes on 2015/12/12
 */
public class HelloServer {

    public static void main(String[] args) {

        //定义端口
        port(8089);


        //query 闭包
        get("/",(request, response) -> "get");

        //删除
        delete("/",((request, response) -> "delete"));
        //update更新
        put("/",((request, response) -> "put"));
        //添加
        post("/",((request, response) -> "post"));

        get("/api/name",(request, response) -> {
            String name = request.queryParams("name");
            System.out.println(name);
            return "hello,"+name;
        });
    }

}
